package com.myblockchain.service.model;



import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author Liu
 * 区块结构
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Block {
    /**
     * 区块索引
     */
    private int index;
    /**
     * 时间戳
     */
    private long timeStamp;

    /**
     * 当前区块的交易集合
     */
    private List<Transaction> transactions;
    /**
     * 工作量证明，计算正确hash的次数
     * 随机数
     */
    private int nonce;
    /**
     * 前一个区块的hash值
     */
    private String previousHash;
    /**
     * 当前区块hash值
     */
    private String hash;

//    public Block() {
//    }
//
//    public Block(String hash, int index, int nonce, String previousHash, long timeStamp, List<Transaction> transactions ) {
//        this.index = index;
//        this.timeStamp = timeStamp;
//        this.transactions = transactions;
//        this.nonce = nonce;
//        this.previousHash = previousHash;
//        this.hash = hash;
//    }
}
